- if @production
  :ruby

    activity = @production

    balance = 0
    expenses = 0
    revenues = 0
    equipment_balance = 0
    worker_balance = 0
    preparation_balance = 0
    other_balance = 0
    currency = Preference[:currency]
    title_legend_complement = " (#{currency})"
    area_unit = :hectare
    title_legend_complement = " (#{currency}/#{area_unit.to_s})"

    supports_quantity = activity.productions.map(&:net_surface_area).compact.sum.round(2)

    data_series = []
    data_worker = []
    data_equipment = []
    data_preparation = []
    data_indirect_expenses = []

    #
    #direct_expenses_by_support_variant_unit = (expenses.to_f/ supports_quantity.to_f).round(2).to_s.to_f rescue 0.0
    #indirect_expenses_by_support_variant_unit = (-1 * (@production.indirect_budget_amount.to_f / supports_quantity.to_f)).round(2).to_s.to_f rescue 0.0
    #global_expenses_by_support_variant_unit = direct_expenses_by_support_variant_unit + indirect_expenses_by_support_variant_unit
    #asset_expenses = 0.32 * indirect_expenses_by_support_variant_unit.to_f
    # équation
    # y : prix d'objectif en [€/ton]
    # a : quantité de budget_item du salaire de l'exploitant [mois]
    a = 12
    # x : salaire mensuel de l'exploitant [€] proratisé à l'unité d'oeuvre et distribué entre activités
    # TODO
    x = 0
    # b : pourcentage de variation du rendement [%]
    b = 1
    # z : rendement de la prodution (budget_item, sens: revenues et varieties: grain)
    # budgets = @production.revenues.where(variant_id: ProductNatureVariant.of_variety(:grain).derivative_of(@production.variant.variety).pluck(:id))
    # puts budgets.inspect.yellow
    # if budgets.first
    #   z = budgets.first.items.average(:quantity).to_s.to_f
    #   # puts z.inspect.green
    #   # c : expenses globales [global_expenses_by_support_variant_unit]
    #   c = global_expenses_by_support_variant_unit.to_s.to_f
    #   # y [€/ton] = (ax + c [€/Ha]) / bz[qt/Ha] * 10
    #   y = (((a * x) + c) / (b * z)) * 10
    #   # puts @production.name
    #   # puts y.to_s.to_f.inspect.red
    # end

  .med-info.important
    %span.title= :products.tl + title_legend_complement
    %span.value=  "--"
    %span.title= :direct_expenses.tl + title_legend_complement
    %span.value= link_to("--", {controller: "/backend/activities" ,action: :show, id: @production.id})
    %span.title= :indirect_expenses.tl + title_legend_complement
    %span.value= "--"
    %span.title= "Dont Ammortissement : "
    %span.value=  "--"
    %span.title= :gross_profit.tl + title_legend_complement
    %span.value=  "--"

- else
  = no_data
